/**
 * 
 */
package com.feonix.designPattern.TemplateMethod.sample1;

/**
 * @CopyRight (c)1993-2017
 * @Project common_practice
 * @Comments 请输入该类的描述
 * @NameSpace com.feonix.designPattern.TemplateMethod.sample1
 * @Author Feonixzw
 * @CreateDate 2018年1月25日
 */
public class StringDisplay extends AbstractDisplay{
	private String str;
	
	private int width;
	
	public StringDisplay(String str) {
		this.str = str;
		this.width = str.getBytes().length;
	}

	/* (non-Javadoc)
	 * @see com.feonix.designPattern.TemplateMethod.sample1.AbstractDisplay#open()
	 */
	@Override
	void open() {
		for(int i=0;i<this.width;i++){
			System.out.println("-");	
		}
		
		
	}

	/* (non-Javadoc)
	 * @see com.feonix.designPattern.TemplateMethod.sample1.AbstractDisplay#print()
	 */
	@Override
	void print() {
		System.out.println(this.str);
	}

	/* (non-Javadoc)
	 * @see com.feonix.designPattern.TemplateMethod.sample1.AbstractDisplay#close()
	 */
	@Override
	void close() {
		for(int i=0;i<this.width;i++){
			System.out.print("-");	
		}
	}
	
}
